<?php
/**
 * Smart Library - Smart Framework
 * http://smart-framework.highet.eu
 *
 * @category   SmartL
 * @package    SmartL_Application
 * @subpackage Login
 * @copyright  Copyright (c) 2005-2008 Smart Framework team - Stepan Sindelar, Vojtech Vit
 * @license    http://www.opensource.org/licenses/bsd-license.php	New BSD License
 */

/**
 * An adapter interface used to log user in using some application-specific
 * login procedure.
 * It makes login method independent on Smart Library systems, because SmartL
 * doesn't do any login logic. It just operates with its results.
 * 
 * @package SmartL_Application
 * @subpackage Login
 */
interface SmartL_Application_Login_Interface {
	const LOGIN_ANONYMOUS = "Anonymous";
	
	/**
	 * This method must log user in using Zend_Auth so it will be possible to
	 * use Zend_Auth::getInstance()->getIdentity() method.
	 * It doesn't matter how it will do it. It can use any resource (e.g. POST 
	 * fields) and authentication method.
	 * 
	 * This method's behavior is similar to behavior of plugin methods. It is
	 * just called at some specific time to do some specific logic.
	 */
	public function login(Zend_Controller_Request_Abstract $request);
	
	/**
	 * Returns names of current user's roles.
	 *
	 * @todo : Když tato funkce nic nevrátí, vznikne velmi špatně odladitelné zacyklení - je třeba to ošetřit výjimkou. Stejně jako všechny jiné "vstupní" body do systému SF
	 * @return array[numeric]=>string
	 */
	public function getUserRoles();
	
	/**
	 * Returns an instance of SmartL_Application_Login_UserPreferences_Interface
	 * which allows SmartL_Application to gain user preferences.
	 * 
	 * @return SmartL_Application_Login_UserPreferences_Interface User preferences
	 */
	public function getUserPreferences();
	
	/**
	 * Returns unique identifier of logged user.
	 * It can be for example username or id from database.
	 * All ids must have same type - string, integer, ...
	 *
	 * @return mixed
	 */
	public function getUserId();
}
